#include "../include/header.h"
int main(int argc, char* argv[]){
	ARGS_CHECK(argc, 2);
	int fd = open(argv[1], O_RDWR);
	ERROR_CHECK(fd, -1, "open");

	// 调整文件大小
	//int ret = ftruncate(fd, 11);
	//ERROR_CHECK(ret, -1, "ftruncate");
	struct stat sb;
	//int ret = stat(argv[1], &sb);
	//ERROR_CHECK(ret, -1, "stat");
	int ret = fstat(fd, &sb);
	ERROR_CHECK(ret, -1, "fstat");
	long size = sb.st_size;


	char* p = (char*)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
	ERROR_CHECK(p, MAP_FAILED, "mmap");


	for(int i = 0; i < size; i++){
		p[i] = toupper(p[i]);
	}


	close(fd);
	return 0;
}